import java.awt.Canvas;
import java.awt.Dimension;

public class JAPI_ValueComponent extends Canvas
{
	private static final long serialVersionUID = 6208305649379001292L;
	
	int w=0,h=0;
	int min=0, max=100;
  	int value=0;

    public JAPI_ValueComponent ()
	{}

    public void setValue(int v)
    {
	    this.value = v<min?min:v>max?max:v;
    }

    public int getValue()
    {
	    return(value);
    }

   	public void setMinimum(int m)
   	{
		min=m;
	}

   	public void setMaximum(int m)
   	{
		max=m;
	}

   	public int getMinimum(int m)
   	{
		return(min);
	}

   	public int getMaximum(int m)
   	{
		return(max);
	}

	public void setSize(int dw, int dh)
	{
		w = dw>0 ? dw : 0;
		h = dh>0 ? dh : 0;
		super.setSize(w,h);
	}

	public Dimension getPreferredSize()
	{
		Dimension dim = super.getPreferredSize();
		dim.width  = w>0 ? w : dim.width;
		dim.height = h>0 ? h : dim.height;
		return(dim);
	}

	public Dimension getMinimumSize()
	{
		return(getPreferredSize());
	}

}
